NAME = SpringBoardAccess

CC = @CC@
OBJC     = @OBJC@
LDFLAGS  = @LDFLAGS@
CPPFLAGS = @CPPFLAGS@
prefix = @prefix@

LIB_LDFLAGS = -lobjc \
              -multiply_defined suppress \
			  -framework CoreFoundation \
			  -framework Foundation \
			  -framework UIKit \
			  -L../3rdparty -lsubstrate

APP_LDFLAGS = -framework CoreFoundation

all: $(NAME).dylib $(NAME)-test

clean:
	rm -f $(NAME).dylib $(NAME)-test
	
$(NAME).dylib: $(NAME)Extension.mm
	$(OBJC) $(CPPFLAGS) -dynamiclib -o $@ $(NAME)Extension.mm -init _$(NAME)Initialize $(LDFLAGS) $(LIB_LDFLAGS)
	@USE_LDID@ export CODESIGN_ALLOCATE=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate ; ldid -S $@

$(NAME)-test: $(NAME)-test.c $(NAME).c
	$(OBJC) $(CPPFLAGS) -o $@  $(NAME).c $(NAME)-test.c $(LDFLAGS) $(APP_LDFLAGS)
	@USE_LDID@ export CODESIGN_ALLOCATE=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate ; ldid -S $@

install:
	echo "SpringBoardAccess is not installed. Use .deb package"
